<template>
	<div class='user-compProject'>
		竞赛项目
		<el-icon
			class="add-icon"
			color="#6782f1"
			:size="50"
			@click="$pushTo('ProjectCreate',{},{projectType:'competition'})"
		>
			<CirclePlusFilled />
		</el-icon>
	</div>
</template>

<script lang="ts">
export default {
  route: {
    meta: {
      needLogin: true
    }
  }
}
</script>
<script setup lang="ts">
import { ref } from 'vue'
import { CirclePlusFilled } from '@element-plus/icons-vue'
import { getMyCompProjects } from '@/api/project'
import { $pushTo } from '@/utils/functions'

const pageNum = 1
const pageSize = 10
let total = 0
const projects = ref([])
const loadProjects = async() => {
  if (projects.value.length >= total) {
    return
  }
  const res = await getMyCompProjects({
    pageNum,
    pageSize
  })
  total = res.data.total
  projects.value = res.data.pageData
  console.log(res.data)
}
loadProjects()
</script>

<style lang="scss" scoped>
.user-compProject {
  .add-icon {
    position: fixed;
    right: 2%;
    bottom: 5%;
    cursor: pointer;
  }
}
</style>
